package com.iflytek.springboot_medicine.pojo;
import com.iflytek.springboot_medicine.entity.Medicine;
import lombok.Data;

@Data
public class MedicinePojo {
    private int id;
    private String name;
    private String category;
    private Double cost_price;
    private Double sale_price;
    private String standard;
    private Integer store_count;
    private String production;
    private String description;
    private Integer status;

    public MedicinePojo() {
    }

    public MedicinePojo(Medicine medicine) {
        this.id = medicine.getId();
        this.name = medicine.getName();
        this.cost_price = medicine.getCost_price();
        this.sale_price = medicine.getSale_price();
        this.standard = medicine.getStandard();
        this.store_count = medicine.getStore_count();
        this.production = medicine.getProduction();
        this.description = medicine.getDescription();
        this.status = medicine.getStatus();
        if (medicine.getCate() != null) {
            this.category = medicine.getCate().getName();
        }
    }
}
